<?

header('Cache-control: private, must-revalidate');
$euro = " ".utf8_encode(chr(128));
$date = date("d-m-Y",strtotime($courrier->date));
list($year,$month,$day) = explode("-",substr($date,0,10));
$path = PUBLIC_DIR;

$pdf->setFontHeight(10);
// Entete 
// Image
$pdf->setX(5);$pdf->setY(5);
if($prefs->entete_logo  == "1"){
    $pdf->afficheImage($path."/logos/".$_SESSION["user_id"]."/".$prefs->entete,50);    
}
if($prefs->entete_text == 1){
    $pdf->setFontHeight(8);
    $pdf->afficheText(stripslashes(html_entity_decode(str_replace("<p>","",$prefs->header))),true,3);
}
// Adresse déstinataire
$pdf->setX(120);$pdf->setY(60);

$contact = $courrier->_contact;

$pdf->afficheText($contact);
$pdf->afficheText($contact->adresse_rue);
$pdf->afficheText($contact->adresse_cp." ".$contact->adresse_ville);
// Corps de la page

$pdf->setX(10);$pdf->setY(90);
$pdf->afficheText(ucfirst(strtolower($user->adresse_ville)).", Le ".date("d/m/Y"));
$pdf->upY();
$pdf->afficheText("<b>Objet :</b> ".$courrier->objet);
$pdf->upY(10);
$pdf->setX(30);
$pdf->setWidth(150);

$text = $courrier->body;
$text = strip_tags($text);
$text = stripslashes($text);
$text = html_entity_decode($text);

$pdf->Write($text);
	   
// Pied de page
$pdf->setX(5);$pdf->setY(280);
$pdf->setWidth(190);$pdf->setFontHeight(9);
$pdf->afficheTd(190,"".stripslashes(html_entity_decode($prefs->footer))."","C",0);

$pdf->output("Facture.pdf","I");
?>